' ManyThng.BAS -- This is my attempt at a variable screen saver
' It is based on an example in "Learn Programming and Visual Basic 2.0"
' by John Socha and Sybex Inc., (highly recommended)
' first written 4-15-93 Bruce McLean
'
Option Explicit
'
' These variables support saving the maximum number of lines
' in the CONTROL.INI file, which is where the Windows 3.1
' screen savers save setup information.
'
Global MaxLines As Integer ' Lines to show before CLS
Global RepeatCount As Integer ' # of lines the same color
Global MaxChangeMinutes As Single ' minutes to go before changing color
Global MaxCums As Integer ' total number of lines before clearing screen
Global BitmapsDir As String ' place to look for bitmaps
Global CycleBitmapsDir As String ' place to look for bitmaps for palette cycling
Global BmpSeconds As Integer ' seconds between bitmaps on slide show
Global RandomFlag As Integer ' non-zero means pick saver at random, else go in sequence
Global StartSaver As Integer ' zero means pick 1st saver at random, else start with saver the corresponds to value
Global ErrorTrace As Integer ' flag to log data for error tracing
Global LowMemoryFlag As Integer 'set this to run special low memory mode
Global TestMode As Integer 'this mode is for debugging code
Global Passwd As String 'where master password is stored
Global Const Scramble = "soDSM" 'to scramble password
Global PasswdScram As String 'scrambled password
Global TotalNumColors As Long 'place to store number of colors display can handle
Global PaletteHandle As Integer
Global FastPaletteCycleFlag As Integer
Global Const iniName = "CONTROL.INI"
Global Const secName = "Screen Saver.Many Things"
Global Const keyName = "MaxLines"
Global Const RepeatName = "RepeatCount"
Global Const ChangeMinutesName = "MaxChangeMinutes"
Global Const MaxCumsName = "MaxCumLines"
Global Const BmpsDirName = "BitmapsDir"
Global Const CycleBmpsDirName = "CycleBitmapsDir"
Global Const BmpSecondsName = "BmpSeconds"
Global Const RandomFlagName = "RandomFlag"
Global Const LowMemoryFlagName = "LowMemoryFlag"
Global Const StartSaverName = "StartSaver"
Global Const ErrorTraceName = "ErrorTrace"
Global Const PasswordName = "Password"
Global Const PriorityBaseName = "Priority"
Global Const FastPaletteCycleName = "FastPaletteCycle"
Global Const NUMCHARS = 25
' windows defines
Type RECT
left As Integer
top As Integer
right As Integer
bottom As Integer
End Type
'Polygon routine that draws any arbitray polygon using fill, etc.
Type POINTAPI
X As Integer
Y As Integer
End Type
' paint type
Type PAINTSTRUCT '32 Bytes
hDC As Integer
fErase As Integer
rcPaint As RECT
fRestore As Integer
fIncUpdate As Integer
rgbReserved As String * 16
End Type
Global Const PALENTRIES = 256
' This is similar to the LOGPALLETTE defined in
' APIDECS.BAS, however instead of using a buffer, we
' create a 64 entry palette for our use.
Type PALETTEENTRY '4 Bytes
peRed As String * 1
peGreen As String * 1
peBlue As String * 1
peFlags As String * 1
End Type
Type LOGPALETTE
palVersion As Integer
palNumEntries As Integer
palPalEntry(PALENTRIES) As PALETTEENTRY
End Type
Global Pal As LOGPALETTE
'Many things DLL routines used:
Declare Function ManyDibAlloc Lib "mnythdll.dll" (ByVal Wdth As Integer, ByVal Hght As Integer) As Long
Declare Function ManyDibFree Lib "mnythdll.dll" () As Integer
Declare Function ManyDibGet Lib "mnythdll.dll" () As Long
Declare Function ManyDibGetData Lib "mnythdll.dll" () As Long
Declare Function ManyDibLoad Lib "mnythdll.dll" (ByVal FileName As String, Wdth As Integer, Hght As Integer) As Long
Declare Function ManyGifLoad Lib "mnythdll.dll" (ByVal FileName As String, Wdth As Integer, Hght As Integer) As Long
Declare Function ManyDibInit Lib "mnythdll.dll" () As Long
Declare Sub ManyDibModPalette Lib "mnythdll.dll" (ByVal red As Integer, ByVal green As Integer, ByVal blue As Integer)
Declare Sub ManyDibCyclePalette Lib "mnythdll.dll" (ByVal StepSize As Integer, ByVal LowValue As Integer, ByVal HighValue As Integer)
Declare Sub ManyLoadLogPal Lib "mnythdll.dll" (Pal As LOGPALETTE, ByVal Start As Integer, ByVal size As Integer, ByVal Flags As Integer)
Declare Function ManyDIBWrite Lib "mnythdll.dll" (ByVal FileName As String) As Integer
' Windows API Routines used:
Declare Function ShowCursor Lib "USER" (ByVal fShow As Integer) As Integer
Declare Sub BitBlt Lib "GDI" (ByVal DestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal BWidth As Integer, ByVal BHeight As Integer, ByVal SourceDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal Constant As Long)
Declare Function StretchBlt Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal nSrcWidth As Integer, ByVal nSrcHeight As Integer, ByVal dwRop As Long) As Integer
Declare Function CopyRect Lib "User" (lpDestRect As RECT, lpSourceRect As RECT) As Integer
Declare Function CreateDC Lib "GDI" (ByVal Driver As Any, ByVal Dev As Any, ByVal O As Any, ByVal Init As Any) As Integer
Declare Sub DrawIcon Lib "User" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal hIcon As Integer)
Declare Function GetCursor Lib "User" () As Integer
Declare Sub GetCursorPos Lib "User" (lpPNT As Integer)
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC As Integer, ByVal nIndex As Integer) As Integer
Declare Function LockResource Lib "Kernel" (ByVal hRes As Integer) As Long
Declare Sub UnlockResource Lib "Kernel" Alias "GlobalUnlock" (ByVal hRes As Integer)
Declare Sub FloodFill Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal color As Long)
Declare Function Polygon Lib "GDI" (ByVal hDC As Integer, lpPoints As POINTAPI, ByVal nCount As Integer) As Integer
Declare Function SetPolyFillMode Lib "GDI" (ByVal hDC As Integer, ByVal nPolyFillMode As Integer) As Integer
Declare Function GetNearestColor Lib "GDI" (ByVal hDC As Integer, ByVal crColor As Long) As Long
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC As Integer, ByVal nIndex As Integer) As Integer
Declare Function SetSysModalWindow Lib "User" (ByVal hWnd As Integer) As Integer
Declare Function SystemParametersInfo Lib "User" (ByVal uAction%, ByVal uParam%, lpvParam As Any, ByVal fuWinIni%) As Integer
Declare Function SelectObject Lib "GDI" (ByVal hDC%, ByVal hObject%) As Integer
Declare Function CreateCompatibleDC Lib "GDI" (ByVal hDC%) As Integer
Declare Function DeleteDC Lib "GDI" (ByVal hDC%) As Integer